package com.vanlian.client.wxapi;


import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.vanlian.client.config.Constance;

public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
	
	private static final String TAG = "ayEntryActivity";
	
    private IWXAPI api;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    	api = WXAPIFactory.createWXAPI(this,null);
		api.registerApp(Constance.wechatAppId);
        api.handleIntent(getIntent(), this);
    }

	@Override
	protected void onNewIntent(Intent intent) {
		super.onNewIntent(intent);
		setIntent(intent);
        api.handleIntent(intent, this);
	}

	@Override
	public void onReq(BaseReq req) {

	}

	@Override
	public void onResp(BaseResp resp) {
		Log.e(TAG, "onPayFinish, errCode = " + resp.errCode);
		Log.e(TAG, "onPayFinish, errCode = " + resp.errStr);
		Log.e(TAG, "onPayFinish, errCode = " + resp.transaction);
		Log.e(TAG, "onPayFinish, errCode = " + resp.openId);
		Log.e(TAG, "onPayFinish, errCode = " + resp.toString());
		Log.e(TAG, "onPayFinish, errCode = " + resp.getType());
		Log.e(TAG, "onPayFinish, errCode = " + resp.checkArgs());


	}
}